﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Ports.aspx.cs" Inherits="_Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <!--#include virtual="include/Head.ascx"-->
    <script type="text/javascript" language="javascript">
        function doDelete(strID, strName) {
            if (confirm('Bạn có thực sự muốn xóa ' + strName + '?')) {
                var vnpage = getUrlVars()['page_number'];
                var vChar = getUrlVars()['letter'];
                var strHref = "";
                if (vnpage)
                    strHref = "Ports.aspx?action=delete&PortsID=" + strID + "&page_number=" + vnpage;
                else
                    strHref = "Ports.aspx?action=delete&PortsID=" + strID;

                if (vChar)
                    window.location.href = strHref + "&letter=" + vChar;
                else
                    window.location.href = strHref;
            }
        }
        function OnServiceAreaSelected(source, eventArgs) {

            var hdnValueID = "<%= hidServiceAreaSearch.ClientID %>";
            document.getElementById(hdnValueID).value = eventArgs.get_value();
            $("#hidServiceAreaSearch").focus();
        }
    </script>
</head>
<body>
    <div id="body-wrapper">
        <div id="header">
            <!--#include virtual="include/top.ascx"-->
        </div>
        <div id="main-content1">
            <h2>CẢNG</h2>
            <div class="clear">
            </div>
            <div class="content-box">
                <form id="frmCarrContact" runat="server" autocomplete="off">
                    <%if (nPermissions >= 3)
                      {%>
                    <div class="content-box-header">
                        <h3 style="cursor: s-resize;">CẢNG: Add [Edit]</h3>
                        <div class="clear">
                        </div>
                    </div>
                    <table class="adminedit" style="width: 100%;">
                        <tr>
                            <th align="left">Name
                            </th>
                            <th align="center">Code
                            </th>
                            <th align="left">Country
                            </th>
                            <th align="left">Service Area
                            </th>
                            <th align="left">Local Used
                            </th>
                        </tr>
                        <tr>
                            <td>
                                <asp:TextBox class="cls" ID="txtPorts" runat="server" Width="300px" TabIndex="2"></asp:TextBox>
                            </td>
                            <td>
                                <asp:TextBox class="cls" ID="txtCode" runat="server" Width="150px" TabIndex="1"></asp:TextBox>
                            </td>
                            <td>
                                <asp:DropDownList class="cls" ID="ddCountryCode" runat="server" Width="200px" TabIndex="4">
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:DropDownList class="cls" ID="ddServiceArea" runat="server" Width="200px" TabIndex="4">
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:CheckBox ID="LocalUsed" runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="5">
                                <label id="msg">
                                </label>
                            </td>
                        </tr>
                    </table>
                    <table class="paramlist admintable" width="100%">
                        <tr>
                            <td colspan="2">
                                <asp:Button class="button" ID="btnSave" runat="server" TabIndex="2" Text="Save" OnClick="btnSave_Click" />
                            </td>
                        </tr>
                    </table>
                    <%} %>
                    <div class="content-box-header">
                        <h3 style="cursor: s-resize;">CẢNG</h3>
                        <div class="clear">
                        </div>
                    </div>
                    <table class="adminedit" style="width: auto; margin: 10px 0px 10px 5px;">
                        <tr>
                            <td align="center" style="font-weight: bold;">Find:
                            </td>
                            <td align="left">
                                <asp:TextBox class="cls" ID="txtCountrySearch" runat="server" Width="150px" value=""
                                    AutoPostBack="true" OnTextChanged="btnSearch_Click" PlaceHolder="Country"></asp:TextBox>
                                <asp:AutoCompleteExtender ID="AutoCompleteExtenderCountry" runat="server" ServiceMethod="CountryAutoCompleteAjaxRequest"
                                    ServicePath="Webservices/AutoComplete.asmx" MinimumPrefixLength="2" CompletionInterval="100"
                                    EnableCaching="false" CompletionSetCount="10" TargetControlID="txtCountrySearch"
                                    FirstRowSelected="false" CompletionListCssClass="completionList" CompletionListItemCssClass="listItem"
                                    CompletionListHighlightedItemCssClass="itemHighlighted">
                                </asp:AutoCompleteExtender>
                            </td>
                            <td>
                                <asp:TextBox class="cls" ID="txtRegionSearch" runat="server" Width="150px" value=""
                                    AutoPostBack="true" OnTextChanged="btnSearch_Click" PlaceHolder="Region"></asp:TextBox>
                                <asp:AutoCompleteExtender ID="AutoCompleteExtenderRegion" runat="server" ServiceMethod="RegionAutoCompleteAjaxRequest"
                                    ServicePath="Webservices/AutoComplete.asmx" MinimumPrefixLength="2" CompletionInterval="100"
                                    EnableCaching="false" CompletionSetCount="10" TargetControlID="txtRegionSearch"
                                    FirstRowSelected="false" CompletionListCssClass="completionList" CompletionListItemCssClass="listItem"
                                    CompletionListHighlightedItemCssClass="itemHighlighted">
                                </asp:AutoCompleteExtender>
                            </td>
                            <td>
                                <asp:TextBox class="cls" ID="txtServiceAreaSearch" runat="server" Width="150px" value=""
                                    AutoPostBack="true" OnTextChanged="btnSearch_Click" PlaceHolder="Service Area"></asp:TextBox>
                                <asp:HiddenField ID="hidServiceAreaSearch" runat="server"></asp:HiddenField>
                                <asp:AutoCompleteExtender ID="AutoCompleteServiceArea" runat="server" ServiceMethod="ServiceAreaAutoCompleteAjaxRequest"
                                    ServicePath="Webservices/AutoComplete.asmx" MinimumPrefixLength="2" CompletionInterval="100"
                                    EnableCaching="false" CompletionSetCount="10" TargetControlID="txtServiceAreaSearch"
                                    FirstRowSelected="false" CompletionListCssClass="completionList" CompletionListItemCssClass="listItem"
                                    CompletionListHighlightedItemCssClass="itemHighlighted"
                                    OnClientItemSelected="OnServiceAreaSelected">
                                </asp:AutoCompleteExtender>
                            </td>
                            <td>
                                <asp:Button class="button" ID="btnSearch" runat="server" Text="Serch" OnClick="btnSearch_Click"
                                    Style="display: none;" />
                            </td>
                            <asp:ToolkitScriptManager ID="ScriptManager1" runat="server">
                            </asp:ToolkitScriptManager>
                        </tr>
                    </table>
                    <%=strAlphaBet%>
                    <fieldset>
                        <%if (nPermissions > 1)
                          { %>
                        <asp:Repeater ID="rptData" runat="server">
                            <ItemTemplate>
                                <tr onmouseover="this.style.background='#dbf0c9'" onmouseout="this.style.background='#ffffff'">
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "Index")%>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "Name") %>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "Code") %>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "Country") %>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "Region") %>
                                    </td>
                                    <td>
                                        <%# DataBinder.Eval(Container.DataItem, "ServiceAreaCode") %>
                                    </td>
                                    <%if ((Session["ports"] != null) && (int.Parse(Session["ports"].ToString()) >= 3))
                                      {%>
                                    <td align="center">
                                        <%# DataBinder.Eval(Container.DataItem, "Action") %>
                                    </td>
                                    <%} %>
                                </tr>
                            </ItemTemplate>
                            <HeaderTemplate>
                                <table cellspacing="0" cellpadding="0" width="100%" border="0" class="adminlist">
                                    <thead>
                                        <tr style="background: #CCC;">
                                            <th align="center" width="50px">Index
                                            </th>
                                            <th align="center">Name
                                            </th>
                                            <th align="center">Code
                                            </th>
                                            <th align="center">Country
                                            </th>
                                            <th align="center">Region
                                            </th>
                                            <th align="center">Service Area
                                            </th>
                                            <%if ((Session["ports"] != null) && (int.Parse(Session["ports"].ToString()) >= 3))
                                              {%>
                                            <th align="center" width="75px">Action
                                            </th>
                                            <%} %>
                                        </tr>
                                    </thead>
                            </HeaderTemplate>
                            <FooterTemplate>
                                </TABLE>
                            </FooterTemplate>
                        </asp:Repeater>
                        <%}
                          else
                          { %>
                        <asp:DataList ID="rptDataView" runat="server" RepeatColumns="5" RepeatDirection="Vertical">
                            <ItemTemplate>
                                <td align="center">
                                    <%# DataBinder.Eval(Container.DataItem, "Index")%>
                                </td>
                                <td>
                                    <%# DataBinder.Eval(Container.DataItem, "Name") %>
                                </td>
                            </ItemTemplate>
                            <%--   <SeparatorTemplate>
                                        </tr>
                                         <tr>
                                    </SeparatorTemplate>--%>
                        </asp:DataList>
                        <%} %>
                    </fieldset>
                    <div class="clear">
                    </div>
                    <div id="footer">
                        <%=strPager%>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>
</html>
